using System;

namespace SharpMud.Text.Formatting.BuiltIn
{
	public class SetForegroundColor : ISetForegroundColor
	{
		#region Instance Stuff
		private SharpMud.Net.Telnet.ANSI.ForegroundColor _Color;

		private SetForegroundColor()
		{
		}
        public SetForegroundColor(SharpMud.Net.Telnet.ANSI.ForegroundColor color)
		{
			_Color = color;
		}
		#endregion

		#region Static Static Stuff
		public class Black : SetForegroundColor
        { public Black() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.Black) { } }

        public class Gray : SetForegroundColor
        { public Gray() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.Gray) { } }

        public class DarkGray : SetForegroundColor
        { public DarkGray() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.DarkGray) { } }

        public class DarkBlue : SetForegroundColor
        { public DarkBlue() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.DarkBlue) { } }

        public class DarkCyan : SetForegroundColor
        { public DarkCyan() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.DarkCyan) { } }

        public class DarkGreen : SetForegroundColor
        { public DarkGreen() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.DarkGreen) { } }

        public class DarkMagenta : SetForegroundColor
        { public DarkMagenta() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.DarkMagenta) { } }

        public class DarkRed : SetForegroundColor
        { public DarkRed() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.DarkRed) { } }

        public class DarkYellow : SetForegroundColor
        { public DarkYellow() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.DarkYellow) { } }

        public class Green : SetForegroundColor
        { public Green() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.Green) { } }

        public class Magenta : SetForegroundColor
        { public Magenta() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.Magenta) { } }

        public class Red : SetForegroundColor
        { public Red() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.Red) { } }

        public class White : SetForegroundColor
        { public White() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.White) { } }

        public class Yellow : SetForegroundColor
        { public Yellow() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.Yellow) { } }

        public class Blue : SetForegroundColor
        { public Blue() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.Blue) { } }

        public class Cyan : SetForegroundColor
        { public Cyan() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.Cyan) { } }

		public class Default : SetForegroundColor
        { public Default() : base(SharpMud.Net.Telnet.ANSI.ForegroundColor.Default) { } }
		#endregion

		#region ISetForegroundColor Members

        public SharpMud.Net.Telnet.ANSI.ForegroundColor Color
		{
			get
			{
				return _Color;
			}
		}

		#endregion

		#region ITextFormatEffect Members

		public string Render(SharpMud.Net.Telnet.Session.TelnetSessionBase telnetSession)
		{
			if(telnetSession.UseMXP)
			{
				return this.ToMXP();
			}
			else if(telnetSession.UseANSI)
			{
				return this.ToANSI();
			}
			else
			{
				return String.Empty;
			}
		}

		public string ToANSI()
		{
			return Net.Telnet.ANSI.Utility.SetColor(this.Color);
		}

		public string ToMXP()
		{
			return "<C " + this.Color.ToString().ToLower() + ">";
		}
		#endregion
	}
}